/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-12 07:00:46
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-22 12:37:02
 */
import 'package:flutter/material.dart';
import 'package:flutter_data_center/components/animation_text.dart';
import 'package:flutter_data_center/controller/home_controller.dart';
import 'package:flutter_data_center/screens/attendance/student/index/school_attendance_screen.dart';
import 'package:flutter_data_center/screens/attendance/teacher/index/teacher_attendance_screen.dart';
import 'package:flutter_data_center/screens/visitor/index/visitor_screen.dart';
import 'package:flutter_data_center/utills/navigator_utils.dart';
import 'package:get/get.dart';

import '../../../../constants.dart';

class TodayStatistics extends StatefulWidget {
  const TodayStatistics({Key key}) : super(key: key);

  @override
  _TodayStatisticsState createState() => _TodayStatisticsState();
}

class _TodayStatisticsState extends State<TodayStatistics> {
  @override
  Widget build(BuildContext context) {
    return GetBuilder<HomeController>(
      builder: (_controller) => Container(
        width: double.infinity,
        height: 125,
        margin: EdgeInsets.only(top: 12),
        padding: EdgeInsets.only(top: 16, right: 18, left: 21, bottom: 25),
        decoration: BoxDecoration(
          color: Theme.of(context).primaryColor,
          borderRadius: BorderRadius.circular(defaultRadius),
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.end,
          children: [
            Text(
              "今日",
              style: TextStyle(
                fontSize: defaultFontSize,
                color: Colors.white,
              ),
            ),
            Expanded(
              child: Row(
                mainAxisSize: MainAxisSize.max,
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                crossAxisAlignment: CrossAxisAlignment.end,
                children: [
                  GestureDetector(
                    onTap: () {
                      NavigatorUtils.pushPageByFade(
                        context: context,
                        targetPage: SchoolAttendanceScreen(),
                        isReplace: false,
                        startMills: 500,
                      );
                    },
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.end,
                      mainAxisAlignment: MainAxisAlignment.start,
                      children: [
                        AnimText(
                          number: _controller.todayStatistics.student,
                          style: TextStyle(
                            fontSize: 48,
                            color: Colors.white,
                            height: 0.8,
                          ),
                        ),
                        SizedBox(width: 5),
                        Text(
                          "学生",
                          style: TextStyle(
                            fontSize: defaultFontSize,
                            color: Colors.white,
                            height: 4,
                          ),
                        ),
                      ],
                    ),
                  ),
                  Spacer(),
                  GestureDetector(
                    onTap: () {
                      NavigatorUtils.pushPageByFade(
                        context: context,
                        targetPage: TeacherAttendanceScreen(),
                        isReplace: false,
                        startMills: 500,
                      );
                    },
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.end,
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        AnimText(
                          number: _controller.todayStatistics.teacher,
                          style: TextStyle(
                            fontSize: 30,
                            color: Colors.white,
                          ),
                        ),
                        SizedBox(width: 5),
                        Text(
                          "教师",
                          style: TextStyle(
                            fontSize: defaultFontSize,
                            color: Colors.white,
                            height: 2,
                          ),
                        ),
                      ],
                    ),
                  ),
                  Spacer(),
                  GestureDetector(
                    onTap: () {
                      NavigatorUtils.pushPageByFade(
                        context: context,
                        targetPage: VisitorScreen(),
                        isReplace: false,
                      );
                    },
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.end,
                      mainAxisAlignment: MainAxisAlignment.end,
                      children: [
                        AnimText(
                          number: _controller.todayStatistics.visiror,
                          style: TextStyle(
                            fontSize: 30,
                            color: Colors.white,
                          ),
                        ),
                        SizedBox(width: 5),
                        Text(
                          "访客",
                          style: TextStyle(
                            fontSize: defaultFontSize,
                            color: Colors.white,
                            height: 2,
                          ),
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
